Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
¿Cómo configuro la velocidad de "setInterval" con controles deslizantes de rango?

Intenté poner una variable que cambia cuando cambia el control deslizante, pero no funcionó. ¿Alguien tiene alguna idea? El siguiente código es algunos ejemplos de lo que estoy tratando de hacer: Es decir: crear un BPM cada segundo que cambia el acorde, creando un control deslizante que cambia el valor de los segundos pero simplemente no funciona y yo no saber como puedo hacerlo.

 //Example of what i wanna do. var i = 0; var inter; var index = 4; function change() { var doc = document.getElementById("First"); var doc2 = document.getElementById("Next1"); const ar = ["A","Am","B","Bm","C","Cm","D","Dm","Em","F","Fm","G","Gm"];//Chords doc.innerHTML = ar[i];//Showing the first chord doc2.innerHTML = ar[i+1];//Showing the next chord i = (i + 1) % ar.length; } inter = setInterval(change, 4000);// this is what im having problems with. //Example of what i tried before this poster: //Did not worked function changeVelocity(){ velocity = document.getElementById("VelocitySlider").value; if(velocity = 40){ inter = setInterval(change, 1.5*1000); } } //What i did in HTML was this. //The input code im talking about: <input oninput="changeVelocity();"onchange="changeVelocity();"type="range" min="40" step="5"max="180" value="40" class="slider" id="Vel">
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

PD: gracias @Asad Gulzar y gracias a @Andy. Resulta que fue más fácil de lo que me costó. Solo tuve que restablecer la primera función (setInterval) haciendo

 var inter = setInterval(function,1000); //reset function changeVelocity(){ velocity = document.getElementById("VelocitySlider").value; if(velocity == 40){// put 2 "==" not just one clearInterval(inter); // reset the variable inter = setInterval(change, 1.5*1000); //adding an new number }```
about 4 years ago · Juan Pablo Isaza Report

0

en cada cambio de rango, debe borrar el setInterval anterior y establecer un nuevo intervalo

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!